/**
 * Created by dev-001 on 2017/2/27.
 * 学科，如语数外
 */
import mongoose from 'mongoose';
import {PointSchema} from '../biz/point';
const Schema = mongoose.Schema;

const ObjectId = Schema.Types.ObjectId;

const SubjectSchema = new Schema({
    name: String,//英语数学历史政治全科等
    school: {
        type: ObjectId,
        ref: 'School'
    },
    textBook: {
        type: ObjectId,
        ref: 'TextBook'
    },
    status: Boolean,
    totalScore: Number,
    type: Number,//1理科，2文科，3艺体, 4通用
    level: Number, //0小学，1初中，2高中
    createdAt: Date,
    updatedAt: Date
});

SubjectSchema.pre('save', function (next) {
    this.createdAt = new Date();
    next();
});


export default mongoose.model('Subject', SubjectSchema);